
var express = require('express');
var router = express.Router();
var order = require("../models/order");

// cancelOrder = function (order_sheet) {
//     return new Promise((resolve, reject) => {
//         order.update({order_sheet: order_sheet},{$set: {ifCancel: true}},(err,docs) => {
//             if (err) reject(err)
//             else resolve(docs)
//         })
//     })
// }


//取消订单
router.post('/', function(req, res, next) {
    order.update({order_sheet: req.body.order_sheet},{$set: {ifCancel: true}},(err,result) => {
        if(err){
            res.json({
                status:"1",
                msg:err.message
            })
        }else{
            res.json({
                status:"0",
                msg:"取消成功",
                result: "suc"
            })
        }
    })
});


module.exports = router;